from docx import Document

doc = Document()

# 添加一个表格，3行4列
table = doc.add_table(rows=3, cols=4)

# 填充表格内容
for i, row in enumerate(table.rows):
    for j, cell in enumerate(row.cells):
        cell.text = f'单元格{i+1}{j+1}'

doc.save('table_example.docx')